package com.cqemme.activitiservice.service;

import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import org.activiti.engine.delegate.DelegateExecution;
import org.springframework.stereotype.Service;

import java.util.Map;

@Service("nurseListen")
public class NurseListen {
    public void dueIng(DelegateExecution execution) {
        Map m=JSONObject.parseObject(JSONObject.toJSONString(execution.getCurrentFlowElement()), Map.class);
        JSONArray field=(JSONArray) m.get("fieldExtensions");
        String nurse=null;
        for (int i=0;i<field.size();i++) {
            //拿到参数名字
            //field.getJSONObject(i).get("fieldName")

            //拿到参数值
            //field.getJSONObject(i).get("stringValue")+""
            if("handelUser".equals(field.getJSONObject(i).get("fieldName"))){
                nurse=field.getJSONObject(i).get("stringValue")+"";
            }
        }
        System.out.println("去提醒---"+nurse+"---去处理任务");
    }
}
